<?php
require_once 'include/topwrap.php';

$top_config = Taoapi_Config::Init();
$top_config->setCharset('UTF-8');

$taoapi = new TopWrap(false,false);

$q = $_GET['q'];

if( $q )
{
	$data = $taoapi->searchItems('0',$q,1,8);
	$counts = count($data['taobaoke_items']['taobaoke_item']);
	for($i = 0; $i < $counts; $i++)
	{
		$data['taobaoke_items']['taobaoke_item'][$i]['pic_url'] = $data['taobaoke_items']['taobaoke_item'][$i]['pic_url'].'_120x120.jpg';
	}
	echo json_encode( $data['taobaoke_items']['taobaoke_item'] );
}